<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js"></script>
	</head>
	<style>
		.star {
			display: flex;
			padding: 0;
		}

		.star li {
			list-style: none;
			margin-right: 5px;
		}

		.star img {
			width: 20px;
		}
	</style>
	<body>
		<div id='app'>
			<ul class="star">
				<li v-for='i in  5' @mouseenter="hoverIdx=i" @mouseleave="hoverIdx=rate" @click="rate=i">
					<img v-if="i<=hoverIdx" src="images/star.png" alt="">
					<img v-else src="images/star-off.png" alt="">
				</li>
			</ul>
			{{rate}}分
		</div>
		<script>
			Vue.createApp({
				data() {
					return {
						hoverIdx: 0,
						rate: 0
					}
				}
			}).mount('#app')
		</script>
	</body>
</html>
